from collections import namedtuple
import inspect

'''实际上，namedtuple 生成的是一个类'''

# FullArgSpec(args=['typename', 'field_names'], varargs=None, varkw=None, defaults=None, kwonlyargs=['verbose', 'rename', 'module'], kwonlydefaults={'verbose': False, 'rename': False, 'module': None}, annotations={})
print(inspect.getfullargspec(namedtuple))

# FullArgSpec(args=['_cls', 'name', 'id', 'age'], varargs=None, varkw=None, defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
print(inspect.getfullargspec(namedtuple('Student',['name','id','age'])))

Student = namedtuple('Student',['name','id','age'])
# print(inspect.getcomments(Student))

# <class '__main__.Student'>
print(Student)

# E:/Daily/DailyNote/Coding/Learning/src/StandardLib/Collections/namedtupleTest.py
# print(inspect.getfile(Student))


# ArgInfo(args=[], varargs=None, keywords=None, locals={'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': <_frozen_importlib_external.SourceFileLoader object at 0x000001D4B4DCA208>, '__spec__': None, '__annotations__': {}, '__builtins__': <module 'builtins' (built-in)>, '__file__': 'E:/Daily/DailyNote/Coding/Learning/src/StandardLib/Collections/namedtupleTest.py', '__cached__': None, 'namedtuple': <function namedtuple at 0x000001D4B6A27EA0>, 'inspect': <module 'inspect' from 'F:\\Python\\python3.6.5\\lib\\inspect.py'>, 'Student': <class '__main__.Student'>})
# print(inspect.getargvalues(inspect.currentframe()))

